package com.zhw.aop;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
//@Aspect
@Slf4j
public class timeAspect {

    @Around("com.zhw.aop.myAspect.pc()")
    public Object runningTime(ProceedingJoinPoint psj) throws Throwable {
        long beginTime = System.currentTimeMillis();

//        执行原始方法
        Object result = psj.proceed();

        long endTime = System.currentTimeMillis();


        log.info(psj.getSignature()+"执行耗时{}ms",endTime-beginTime);


        return result;
    }
}
